package com.med.controller;

import com.med.dto.RespondDTO;
import com.med.entity.AppointmentDO;
import com.med.entity.AppointmentOrderDO;
import com.med.entity.MedicineOrderDO;
import com.med.service.IOrderFrontService;
import com.med.vo.OrderVO;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @BelongsProject: internet-based-healthcare02
 * @BelongsPackage: com.med.controller
 * @Author: WWJ
 * @CreateTime: 2025-08-27 15:56
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RefreshScope
@RequestMapping("/orders")
public class OrderFrontController {
    @Autowired
    private IOrderFrontService orderService;
    //查询全部订单信息
    @GetMapping("/selectall")
    public R<List<AppointmentOrderDO>> selectAllOrder(@RequestParam Integer userId) {
        List<AppointmentOrderDO> orderList = orderService.selectAllOrder(userId);
        return R.ok(orderList);
    }

    //查询全部订单信息
    @GetMapping("/selectMedicine")
    public R<List<MedicineOrderDO>> selectMedicineOrder(@RequestParam Integer userId) {
        List<MedicineOrderDO> list = orderService.queryMedicineOrder(userId);
        return R.ok(list);
    }

    //查询可预约信息
    @GetMapping("/selectAppointment")
    public R<List<AppointmentDO>> selectAll() {
        List<AppointmentDO> allAppointment = orderService.getAllAppointment();
        return R.ok(allAppointment);
    }

    @RequestMapping("/queryMedicine")
    public RespondDTO queryMedicine(OrderVO orderVO){
        RespondDTO queryMedicine = orderService.queryMedicine(orderVO);
        return queryMedicine;
    }

    @RequestMapping("/doctorInfo")
    public RespondDTO doctorInfo(OrderVO orderVO) {
        RespondDTO doctorInfo = orderService.doctorInfo(orderVO);
        return doctorInfo;
    }

    @RequestMapping("/insertComment")
    public RespondDTO insertComment(OrderVO orderVO) {
        RespondDTO insertComment = orderService.insertComment(orderVO);
        return insertComment;
    }

    @RequestMapping("/isComment")
    public RespondDTO isComment(OrderVO orderVO) {
        RespondDTO isComment = orderService.isComment(orderVO);
        return isComment;
    }
}
